package io.codegeneratetool.util.validate;
 
import java.lang.reflect.Field;
import java.util.Map;

import org.hibernate.validator.constraints.Length;

public class LengthProcessor extends BaseProcessorChain<Length> {

	public <T> void process(T t, Field field,
			Map<String, Object> validateContainer, Map<String, Object> messages) {
		Length annotation = field.getAnnotation(Length.class);
			int max = annotation.max();
			int min = annotation.min();
		 
			validateContainer.put("maxlength", max);
			messages.put("maxlength", getMessage(annotation.message(),"最大长度 "+ max));
 
			validateContainer.put("minlength", min);
			messages.put("minlength", getMessage(annotation.message(),"最小长度 "+ min));
 
	}

}
